package com.kuang;

import sun.text.resources.cldr.es.FormatData_es_419;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * ClassName: TestJoin
 * Description:
 * Date: 2021/3/16 19:26
 * Company: TravelSky
 *
 * @author YangXin
 */
public class TestJoin implements Runnable{
    //测试join方法
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("线程vip来了"+ i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        //启动线程
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        //主线程
        for (int i = 0; i < 100; i++) {
            if (i == 50){
                thread.join();//强制插队
            }
            System.out.println("main"+i);
        }
    }

}
